/*
 * Copyright (c) 2013.
 * 游戏服务器核心代码编写人陈磊拥有使用权
 * 联系方式：E-mail:13638363871@163.com ;qq:502959937
 * 个人博客主页：http://my.oschina.net/chenleijava
 */

package com.dc.gameserver.serverCore.service.battle.coreBattleLogic.differentCardType;

import com.dc.gameserver.hardCode.CardType;
import com.dc.gameserver.serverCore.service.battle.GameFormula;
import com.dc.gameserver.serverCore.service.battle.coreBattleLogic.AbstractDifferentLogic;
import com.dc.gameserver.serverCore.service.battle.coreBattleLogic.ISoul;
import com.dc.gameserver.serverCore.service.cardModule.CardBox;
import com.dc.gameserver.serverCore.service.cardModule.CardBoxManager;
import com.dc.gameserver.serverCore.service.character.GameCharacter;
import org.springframework.stereotype.Service;

/**
 * @author 石头哥哥</br>
 *         Project : gameServer1.1</br>
 *         Date: 13-11-2  11</br>
 *         Time: 下午4:47</br>
 *         Connect: 13638363871@163.com</br>
 *         packageName: Server.ServerCore.Service.fightProcess.differentCardType</br>
 *         注解：12  神识+防御
 */
@Service
public class d_soul_deffence extends AbstractDifferentLogic {


    @Override
    public void PostConstruct() {
        IDIFFERENTS[Integer.parseInt(CardType.SOUL_TYPE.getType()+""+CardType.DEFENCE_TYPE.getType())]=this;
    }


    /**
     * 处理不同类型牌的逻辑
     * @param p1   优先级高的玩家   神识
     * @param p2   优先级低的玩家   防御
     */
    @Override
    public void differentLogicHandle(GameCharacter p1,GameCharacter p2) {
        //p1神识牌判定
        //gameCharacter 玩家出神识牌  ,是否造成对手眩晕
        CardBox cardBox= CardBoxManager.getCardBoxByID(p1.getCardBoxID());
        int soulType=GameFormula.getSoulSkillType(p1.getOutCardsList().size());
        boolean status= ISoul.SOULS[soulType].SoulHandle(p1, p2);
        if (status&&p2.getCurrentShield()==0||status&&p2.getDizzinessTimes()!=0){
            return;
        }
        //p2防御生效
        CardBoxManager.DeffenceCompute(p2);
        cardBox.flushBloodAndMagic();
        cardBox.resetRoundResource();


    }

}
